<?php
class HeadWidget extends CWidget
{
    public function init()
    {
        parent::init();
    }
    public function run()
    {
        $message_count = 0;
        $is_login=Yii::app()->user->getIsGuest();
        if (!$is_login) {
            $id=Yii::app()->user->getId();
            $user_info=User::model()->getDetail($id);
            $message_count = Message::model()->getCount(array('user_id'=>$id,'is_read'=>Message::UN_READ));
            $name=Yii::app()->user->name;
        }
        $this->render('head',compact('name','is_login','message_count'));
    }
}
?>
